package Unite;

public class Archer extends Unit {

	final static private double POWER_RATIO = 4;
	final static private double WEIGHT_RATIO = 3;
	final static private Integer CLASSE = ARCHER;

	/**
	 * @param attributes
	 * @param level
	 */
	public Archer(AttributeMap attributes, int level) {

		super(attributes, level);
		_power = calculatePower();
		_weight = calculateWeight();
	}

	/**
	 * @return
	 */
	private int calculateWeight() {
		return _attributes.getWeight();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see Unite.Unit#getWeight()
	 */
	public double getWeight() {
		return _weight * WEIGHT_RATIO / 10;
	}

	/**
	 * @return
	 */
	private double calculatePower() {
		final double ratioAttr = 0.25;
		return _attributes.get(AttributeMap.AGILITY) * ratioAttr
				+ _attributes.get(AttributeMap.CONCENTRATION) * ratioAttr
				+ _attributes.get(AttributeMap.DEXTERITY) * ratioAttr
				+ _attributes.get(AttributeMap.TACTIC) * ratioAttr;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see Unite.Unit#getPower()
	 */
	public double getPower() {
		return _power * POWER_RATIO / 10;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see Unite.Unit#getClasseId()
	 */
	public int getClasseId() {
		return CLASSE;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see Unite.Unit#getCopy()
	 */
	public Archer getCopy() {
		return new Archer(getAttributes(), getLevel());
	}

}
